﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Animal
    {
        private int leg;

        public int Leg
        {
            get { return this.leg; }
            set { this.leg = value; }
        }

        public void Eat()
        {
            Console.WriteLine("我能吃");
        }
        public void Walk()
        {
            Console.WriteLine("我能走路");
        }
        public void Sleep()
        {
            Console.WriteLine("我能睡觉");
        }

        //实现一些共有的功能，可以做一些准备的工作
        public virtual void Cry()
        {
            Console.WriteLine("深呼吸，张开嘴，我要叫了");
        }


    }
    class BirdType : Animal
    {
        public void Fly()
        {
            Console.WriteLine("我能飞");
        }
    }
    class CatType : Animal
    {
        public void SeeInNight()
        {
            Console.WriteLine("我能在晚上看见东西");
        }
    }
    class Cat : CatType
    {
        public void CatchMouse()
        {
            Console.WriteLine("我可以抓老鼠");
        }
        public override void Cry()
        {
            base.Cry();
            Console.WriteLine("喵喵喵");
        }
    }
    class Tiger : CatType
    {
        public void Eatpeople()
        {
            Console.WriteLine("我可以活吞人");
        }
        public override void Cry()
        {
            base.Cry();
            Console.WriteLine("咆哮");
        }

    }
    class Swallow : BirdType
    {
        public void FlyToSouth()
        {
            Console.WriteLine("我能往南飞");
        }

        public override void Cry()
        {
            base.Cry();
            Console.WriteLine("唧唧唧");
        }
    }
    class Eagle : BirdType
    {
        public void Eatchick()
        {
            Console.WriteLine("我能抓小鸡");
        }
        public override void Cry()
        {
            base.Cry();
            Console.WriteLine("芜湖");
        }
    }
    
    class PetStore
    {
        public void ConsignCat(Cat c)
        {
            //寄养
            c.Eat();
            c.Walk();
            c.Sleep();
            c.Cry();
            c.CatchMouse();
        }

        public void ConsignTiger(Tiger t)
        {
            t.Eat();
            t.Walk();
            t.Sleep();
            t.Cry();
        }

        public void ConsignSwallow(Swallow s)
        {
            s.Eat();
            s.Walk();
            s.Sleep();
            s.Cry();
            s.FlyToSouth();
        }

        public void ConsignAnimal(Animal a)
        {
            a.Eat();
            a.Walk();
            a.Sleep();
            a.Cry();
            
        }
    }
    class Program2
    {
        static void Main(string[] args)
        {
            Tiger t = new Tiger();
            t.Leg = 4;
            t.Walk();
            t.Eat();
            t.Sleep();
            t.Cry();
            t.SeeInNight();
            t.Eatpeople();

            Console.WriteLine("-----------分割线---------------");

            Cat c = new Cat();
            c.Leg = 4;
            c.Walk();
            c.Eat();
            c.Sleep();
            c.Cry();
            c.SeeInNight();
            c.CatchMouse();
            Console.WriteLine("-----------分割线---------------");

            Eagle e = new Eagle();
            e.Leg = 2;
            e.Walk();
            e.Eat();
            e.Sleep();
            e.Cry();
            e.Fly();
            e.Eatchick();
            Console.WriteLine("-----------分割线---------------");

            Swallow s = new Swallow();
            s.Leg = 2;
            s.Walk();
            s.Eat();
            s.Sleep();
            s.Cry();
            s.Fly();
            s.FlyToSouth();
            Console.WriteLine("-----------分割线---------------");
            Console.WriteLine("欢迎来到屿森宠物店，请问你要寄存什么动物呢：1、猫；2、燕子；3、老鹰；4、老虎");
            int key = int.Parse(Console.ReadLine());
            Animal z;
            switch (key)
            {
                case 1:
                    z = new Cat();
                    break;
                case 2:
                    z = new Swallow();
                    break;
                case 3:
                    z = new Eagle();
                    break;
                case 4:
                    z = new Tiger();
                    break;
                default:
                    Console.WriteLine("没有该选项");
                    z = new Tiger();
                    break;
            }
            PetStore ps = new PetStore();
            ps.ConsignAnimal(z);
            Console.ReadKey();
    }
    }
}
